<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="./template/DefaultTemplate.xhtml">

    <ui:define name="top">
        top
    </ui:define>

    <ui:define name="left">
        left
    </ui:define>

    <ui:define name="content">
        <h:form>
            <p:panel header="View Email: #{email.selectedMessage.subject}">
                <h:panelGrid columns="4">
                    <p:commandButton value="Reply" action="#{email.prepareReply}" ajax="false"/>
                    <p:commandButton value="Reply All" action="#{email.prepareReplyAll}" ajax="false"/>
                    <p:commandButton value="Forward" action="#{email.prepareForward}" ajax="false"/> 
                    <p:commandButton value="Back to Email" action="/email.xhtml" actionListener="#{email.emptyFields}" ajax="false"/> 
                </h:panelGrid>
                <h:panelGrid columns="2">
                    <h:outputText value="From:" style="font-weight: bold"/>
                    <h:outputText value="#{(email.selectedMessage.from)[0].toString()}" />
                    <h:outputText value="Subject:" style="font-weight: bold"/>
                    <h:outputText value="#{email.selectedMessage.subject}" />
                    <h:outputText value="Date Sent:" style="font-weight: bold"/>
                    <h:outputText value="#{email.selectedMessage.sentDate.toString()}" /> 
                    <h:outputText value="To:" style="font-weight: bold"/>
                    <h:outputText value="#{email.getRecipientsTo()}" />
                    <h:outputText value="CC:" style="font-weight: bold"/>
                    <h:outputText value="#{email.getRecipientsCc()}" />
                    <h:outputText value="Message:" style="font-weight: bold"/> 
<!--                    <p:inputTextarea value="#{email.selectedMessage.getContent().toString()}" style="width:640px;height:800px" readonly="true"/>-->
                </h:panelGrid>
                <h:panelGrid columns="2">
                    <h:outputText value=""/>
                <p:panel style="width:640px;height:800px">
                    <h:outputText escape="false" value="#{email.selectedMessage.getContent().toString()}"/>
                    </p:panel>
                    </h:panelGrid>
            </p:panel>
        </h:form>
    </ui:define>

</ui:composition>
